from django.contrib import admin
from training.models import *


class ProjectAdmin(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields': ['name']}),
        ('培训时间设置', {'fields': ['begin_time', 'end_time'], 'classes': ['wide']}),
        ('培训课程设置', {'fields': ['courses'], 'classes': ['wide']}),
    ]
    list_display = ('name', 'begin_time', 'end_time', 'is_not_end', 'courses_names')
    list_filter = ['begin_time', 'end_time']
    filter_horizontal = ('courses',)
    search_fields = ['name']


class CourseAdmin(admin.ModelAdmin):
    pass


admin.site.register(Course, CourseAdmin)
admin.site.register(Project, ProjectAdmin)
admin.site.register(Student)
admin.site.register(Teacher)
admin.site.register(TrainingClass)